﻿/********************************************************************
	日期:2022/03/31
	名称:CreateWnd
	邮箱:yunnibbd@163.com
	作者:yunni
	描述:角色创建界面
*********************************************************************/

using PEProtocol;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class CreateWnd : WindowRoot{
    public InputField iptName;

    protected override void InitWnd(){
        base.InitWnd();
        //TODO
        //显示一个随机名字
        iptName.text = resSvc.GetRDNameData(false);
    }

    public void ClickRandomBtn(){
        audioSvc.PlayUIMusic(Constants.UIClickBtn);
        string rdName = resSvc.GetRDNameData(false);
        iptName.text = rdName;
    }

    public void ClickEnterBtn(){
        audioSvc.PlayUIMusic(Constants.UIClickBtn);
        if (iptName.text != ""){
            //TODO 发送名字到服务器，登录主城
            GameMsg msg = new GameMsg{
                cmd = (int) CMD.ReqRename,
                reqRename = new ReqRename{
                    name = iptName.text
                }
            };
            netSvc.SendMsg(msg);
        }
        else{
            GameRoot.AddTips("当前名字不合法");
        }
    }
}
